import Swiper from "../../../assets/swiper8/swiper-bundle.esm.browser.js";
export default {
    template:`
    <div class="swiper" ref="loop">
        <div class="swiper-wrapper">
           <slot>
                <div class="swiper-slide loading">
                    <img src="../../assets/img/loading.gif">
                </div>
           </slot>
        </div>
        // 分页器插槽
        // 左右按钮插槽
    </div>
    `,
    props:{
        option:{
            type:Object,
            default(){
                return {}
            }
        },
        data:{
            type:Object,
            default(){
                return {}
            }
        }
    },
    watch: {
        data:{
            handler(){
                // console.log(1);
                this.$nextTick(()=>{
                    this.$swiper.updateSlides()
                })
            },
            deep:true
        }
    },
    methods: {
        initLoop() {
            this.$swiper = new Swiper(this.$refs.loop,this.option)
        }
    },
    mounted () {
        this.initLoop();
    },
}